<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@page import="javax.faces.context.FacesContext;" %>
<%@page import="entidade.controller.JSF.PermissaoController;"%>


<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
            <title>Global Image - Login</title>
        </head>
        <body>
            
            <%
                FacesContext fc = FacesContext.getCurrentInstance();
                PermissaoController permController = (PermissaoController) fc.getApplication().getELResolver().getValue(fc.getELContext(), null, "permissao");
                if(permController.getUsuarioLogado() != null){
                    response.sendRedirect("http://localhost:8606/globalimage2/faces/welcomeJSF.jsp");
                }
            %>
            
            <%@include file="WEB-INF/jspf/header/head.jspf"%>
            <h3>Login</h3>
            <h:form>
                <h:panelGrid columns="2">
                    <h:outputText value="Email:"/>
                    <h:inputText id="email" value="#{permissao.loginEmail}" maxlength="254" size="16" title="Email" required="true" requiredMessage="O campo email deve ser preenchido"/>
                    <h:outputText value="Senha:"/>
                    <h:inputSecret id="senha" value="#{permissao.loginPwd}" maxlength="8" size="16" title="Senha" required="true" requiredMessage="O campo senha deve ser preenchido"/>
                </h:panelGrid>
                <h:panelGroup id="messagePanel" layout="block">
                    <h:messages errorStyle="color: red" infoStyle="color: green" layout="table"/>
                </h:panelGroup>
                <h:commandLink action="#{permissao.login}" value="Entrar" />&nbsp;|&nbsp;
                <h:commandLink action="#{permissao.esqueciMinhaSenha}" value="Esqueci minha senha" immediate="true"/>
            </h:form>
        </body>
    </html>
</f:view>